//
//  CZNetworkTool.m
//  网易新闻
//
//  Created by apple on 16/1/20.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "CZNetworkTool.h"

@implementation CZNetworkTool

+(instancetype)sharedManager{
    static CZNetworkTool *instance;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
        
        instance = [[CZNetworkTool alloc] initWithBaseURL:[NSURL URLWithString:@"http://192.168.1.127:9012/openapi/"] sessionConfiguration:config];
        
        instance.requestSerializer = [AFHTTPRequestSerializer serializer];
        instance.responseSerializer = [AFHTTPResponseSerializer serializer];
//        instance.requestSerializer = [AFJSONRequestSerializer serializer];
//        instance.responseSerializer = [AFJSONResponseSerializer serializer];

        instance.responseSerializer.acceptableContentTypes = [NSSet setWithObjects: @"application/json",@"text/json",@"text/javascript",@"text/html",nil];
        
        //设置超时时间
        config.timeoutIntervalForRequest = 10;
    });
    return instance;
}

@end
